package com.ruofeng.app.kotlin

import com.choosefine.base.attendance.server.listener.AttendanceListener
import com.fasterxml.jackson.databind.ObjectMapper
import java.util.*

/**
 * Created by 邱鹏 on 2017/8/28.
 */
open class ServerStarter{
    var jsonObjectMapper = ObjectMapper()
    fun startAttendanceListener() {
        var result: String? = null
        val attendanceListener = AttendanceListener("192.168.59.33", "9920")
        val resultMap = HashMap<String, Any>()
        if (attendanceListener.isServerRunning) {
            resultMap.put("status", 200)
            resultMap.put("message", "监听创建成功")
            result = jsonObjectMapper.writeValueAsString(resultMap)
        } else {
            resultMap.put("status", 500)
            resultMap.put("message", "监听创建异常")
            result = jsonObjectMapper.writeValueAsString(resultMap)
        }
        println(result)
    }
}

fun main(args: Array<String>) {
    ServerStarter().startAttendanceListener()
}